* Org mode specific config
:PROPERTIES:
:CUSTOM_ID: org-mode-specific-configuration
:END:

#+begin_src elisp
;; Set a font, in which CJK characters are twice the width of for
;; example ASCII characters, to enable better alignment in org mode
;; tables.

(add-hook 'org-mode-hook
          (function
           (lambda ()
             ;; Only do the following in graphical mode, as it will
             ;; break when using emacs in terminal mode.
             (when (display-graphic-p)
               ;; Sarasa font is from https://github.com/be5invis/Sarasa-Gothic.
               ;; (buffer-face-set cjk-monospaced-font)
               (setq buffer-face-mode-face
                     '(:family "Sarasa Mono CL"
                       :weight normal
                       :height 110))
               (buffer-face-mode)))))
#+end_src

* Font configuration
:PROPERTIES:
:CUSTOM_ID: font-configuration
:END:

#+begin_src elisp
;; A fontset font seems to be a font, which is used for a specific set of
;; characters, which can be associated with a particular language. Using fontset
;; font settings, it should be possible to set a font per langugage, as is
;; probably done on the Emacs HELLO page.

;; Only do the following in graphical mode, as it will break when
;; using emacs in terminal mode.
(when (display-graphic-p)
  (progn
    (push `("Sarasa Mono CL" . ,(/ 16.0 13.0))
          face-font-rescale-alist)
    (dolist (charset '(kana han symbol cjk-misc bopomofo))
      (set-fontset-font "fontset-default"
            charset
            (font-spec :family "Sarasa Mono CL"
                   :weight 'normal)))))
#+end_src
